#include <stdio.h>
int main(int argc, char *argv[]) 
{
	char A[3][5],B[3][5];
	
	int sum_A[3],sum_B[3],start1[3],start2[3],other1[3],other2[3],worry=0,level_a,level_b;
	scanf("%s %s %s",A[0],A[1],A[2]);
	scanf("%s %s %s",B[0],B[1],B[2]);
	for(int i=0;i<3;i++)
		{
			if(A[i][0]=='C')start1[i]=0;
			else if(A[i][0]=='D')start1[i]=30;
			else if(A[i][0]=='S')start1[i]=60;
			else if(A[i][0]=='H')start1[i]=90;
			else worry=1;
			
			for(int j=1;j<2;j++)
				{
					if('2'<=A[i][j]&&A[i][j]<='9')other1[i]=A[i][j]-'0';
					else if('1'==A[i][j]&&A[i][2]=='0')other1[i]=10;
					else if(A[i][j]=='J')other1[i]=11;
					else if(A[i][j]=='Q')other1[i]=12;
					else if(A[i][j]=='K')other1[i]=13;
					else if(A[i][j]=='A')other1[i]=14;
					else worry=1;
				}
			sum_A[i]=start1[i]+other1[i];
		}
	int a,b,c;
	if(sum_A[0]>sum_A[1]&&sum_A[0]>sum_A[2]&&sum_A[1]>sum_A[2]){a=0;b=1;c=2;}
	if(sum_A[0]>sum_A[1]&&sum_A[0]>sum_A[2]&&sum_A[2]>sum_A[1]){a=0;b=2;c=1;}
	if(sum_A[1]>sum_A[0]&&sum_A[1]>sum_A[2]&&sum_A[0]>sum_A[2]){a=1;b=0;c=2;}
	if(sum_A[1]>sum_A[0]&&sum_A[1]>sum_A[0]&&sum_A[2]>sum_A[0]){a=1;b=2;c=0;}
	if(sum_A[2]>sum_A[1]&&sum_A[2]>sum_A[0]&&sum_A[0]>sum_A[1]){a=2;b=0;c=1;}
	if(sum_A[2]>sum_A[1]&&sum_A[2]>sum_A[0]&&sum_A[1]>sum_A[0]){a=2;b=1;c=0;}
	if(sum_A[0]==sum_A[1]||sum_A[0]==sum_A[2]||sum_A[1]==sum_A[2]){worry=1;}
	
	int z,x,y;
	if(other1[0]>=other1[1]&&other1[0]>=other1[2]&&other1[1]>=other1[2]){z=0;x=1;y=2;}
	if(other1[0]>=other1[1]&&other1[0]>=other1[2]&&other1[2]>=other1[1]){z=0;x=2;y=1;}
	if(other1[1]>=other1[0]&&other1[1]>=other1[2]&&other1[0]>=other1[2]){z=1;x=0;y=2;}
	if(other1[1]>=other1[0]&&other1[1]>=other1[0]&&other1[2]>=other1[0]){z=1;x=2;y=0;}
	if(other1[2]>=other1[1]&&other1[2]>=other1[0]&&other1[0]>=other1[1]){z=2;x=0;y=1;}
	if(other1[2]>=other1[1]&&other1[2]>=other1[0]&&other1[1]>=other1[0]){z=2;x=1;y=0;}
	
	for(int i=0;i<3;i++)
		{
			if(B[i][0]=='C')start2[i]=0;
			else if(B[i][0]=='D')start2[i]=30;
			else if(B[i][0]=='S')start2[i]=60;
			else if(B[i][0]=='H')start2[i]=90;
			else worry=1;
			
			for(int j=1;j<2;j++)
				{
					if('2'<=B[i][j]&&B[i][j]<='9')other2[i]=B[i][j]-'0';
					else if('1'==B[i][j]&&B[i][2]=='0')other2[i]=10;
					else if(B[i][j]=='J')other2[i]=11;
					else if(B[i][j]=='Q')other2[i]=12;
					else if(B[i][j]=='K')other2[i]=13;
					else if(B[i][j]=='A')other2[i]=14;
					else worry=1;
				}
			sum_B[i]=start2[i]+other2[i];
		}
	int e,f,g;
	if(sum_B[0]>sum_B[1]&&sum_B[0]>sum_B[2]&&sum_B[1]>sum_B[2]){e=0;f=1;g=2;}
	if(sum_B[0]>sum_B[1]&&sum_B[0]>sum_B[2]&&sum_B[2]>sum_B[1]){e=0;f=2;g=1;}
	if(sum_B[1]>sum_B[0]&&sum_B[1]>sum_B[2]&&sum_B[0]>sum_B[2]){e=1;f=0;g=2;}
	if(sum_B[1]>sum_B[0]&&sum_B[1]>sum_B[0]&&sum_B[2]>sum_B[0]){e=1;f=2;g=0;}
	if(sum_B[2]>sum_B[1]&&sum_B[2]>sum_B[0]&&sum_B[0]>sum_B[1]){e=2;f=0;g=1;}
	if(sum_B[2]>sum_B[1]&&sum_B[2]>sum_B[0]&&sum_B[1]>sum_B[0]){e=2;f=1;g=0;}
	if(sum_B[0]==sum_B[1]||sum_B[0]==sum_B[2]||sum_B[1]==sum_B[2]){worry=1;}
	
	int m,n,q;
	if(other2[0]>=other2[1]&&other2[0]>=other2[2]&&other2[1]>=other2[2]){m=0;n=1;q=2;}
	if(other2[0]>=other2[1]&&other2[0]>=other2[2]&&other2[2]>=other2[1]){m=0;n=2;q=1;}
	if(other2[1]>=other2[0]&&other2[1]>=other2[2]&&other2[0]>=other2[2]){m=1;n=0;q=2;}
	if(other2[1]>=other2[0]&&other2[1]>=other2[0]&&other2[2]>=other2[0]){m=1;n=2;q=0;}
	if(other2[2]>=other2[1]&&other2[2]>=other2[0]&&other2[0]>=other2[1]){m=2;n=0;q=1;}
	if(other2[2]>=other2[1]&&other2[2]>=other2[0]&&other2[1]>=other2[0]){m=2;n=1;q=0;}

	if(worry==0)
		{
			if(sum_A[a]-sum_A[c]==2)
			{
				if(sum_B[e]-sum_B[g]==2)
					{
						if(sum_A[a]%30-sum_B[e]%30>0)printf("Winner is A!\n");
						if(sum_A[a]%30-sum_B[e]%30<0)printf("Winner is B!\n");
						if(sum_A[a]%30-sum_B[e]%30==0)
						{
							if(start1[0]>start2[0])printf("Winner is A!\n");
							if(start1[0]<start2[0])printf("Winner is B!\n");
							if(start1[0]==start2[0])printf("Draw!\n");
						}
					}
				else printf("Winner is A!\n");
			}
			else if(sum_A[a]%30==sum_A[b]%30&&sum_A[a]%30==sum_A[c]%30)
			{
				if(sum_B[e]-sum_B[g]==2)printf("Winner is B!\n");
				else if(sum_B[e]%30==sum_B[f]%30&&sum_B[e]%30==sum_B[f]%30)
				{
					if(sum_A[a]%30>sum_B[e]%30)printf("Winner is A!\n");
					if(sum_A[a]%30<sum_B[e]%30)printf("Winner is B!\n");
					if(sum_A[a]%30==sum_B[e]%30)
					{
						if(start1[0]+start1[1]+start1[2]>start2[0]+start2[1]+start2[2])printf("Winner is A!\n");
						if(start1[0]+start1[1]+start1[2]<start2[0]+start2[1]+start2[2])printf("Winner is B!\n");
						if(start1[0]+start1[1]+start1[2]==start2[0]+start2[1]+start2[2])printf("Draw!\n");
					}
				}
				else printf("Winner is A!\n");
			}
			else if(other1[z]-other1[y]==2&&other1[z]-other1[x]==1)
			{
				if(sum_B[e]-sum_B[g]==2)printf("Winner is B!\n");
				else if(sum_B[e]%30==sum_B[f]%30&&sum_B[e]%30==sum_B[g]%30)printf("Winner is B!\n");
				else if(other2[m]-other2[q]==2&&other2[m]-other2[n]==1)
				{
					if(other1[z]>other2[m])printf("Winner is A!\n");
					if(other1[z]<other2[m])printf("Winner is B!\n");
					if(other1[z]==other2[m])
					{
						if(start1[0]+start1[1]+start1[2]>start2[0]+start2[1]+start2[2])printf("Winner is A!\n");
						if(start1[0]+start1[1]+start1[2]<start2[0]+start2[1]+start2[2])printf("Winner is B!\n");
						if(start1[0]+start1[1]+start1[2]==start2[0]+start2[1]+start2[2])printf("Draw!\n");
					}
				}
				else printf("Winner is A!\n");
			}
			else if(sum_A[a]%30==sum_A[b]%30||sum_A[a]%30==sum_A[c]%30||sum_A[c]%30==sum_A[b]%30)
			{
				if(sum_B[e]-sum_B[g]==2)printf("Winner is B!\n");
				else if(sum_B[e]%30==sum_B[f]%30&&sum_B[e]%30==sum_B[f]%30)printf("Winner is B!\n");
				else if(other2[m]-other2[q]==2&&other2[m]-other2[n]==1)printf("Winner is B!\n");
				else if(sum_B[e]%30==sum_B[f]%30||sum_B[e]%30==sum_B[g]%30||sum_B[f]%30==sum_B[g]%30)
				{
					if(other1[0]==other1[1])
						{
							if(other2[0]==other2[1])
							{
								if(other1[0]>other2[1])printf("Winner is A!\n");
								if(other1[0]<other2[1])printf("Winner is B!\n");
								if(other1[0]==other2[1])printf("Draw!\n");
							}
							if(other2[0]!=other2[1])
							{
								other2[0]=other2[1]=other2[2];
								if(other1[0]>other2[1])printf("Winner is A!\n");
								if(other1[0]<other2[1])printf("Winner is B!\n");
								if(other1[0]==other2[1])printf("Draw!\n");
							}
						}
					if(other1[0]!=other1[1])
						{
							other1[0]=other1[1]=other1[2];
							if(other2[0]==other2[1])
								{
									if(other1[0]>other2[1])printf("Winner is A!\n");
									if(other1[0]<other2[1])printf("Winner is B!\n");
									if(other1[0]==other2[1])printf("Draw!\n");
								}
							if(other2[0]!=other2[1])
								{
									other2[0]=other2[1]=other2[2];
									if(other1[0]>other2[1])printf("Winner is A!\n");
									if(other1[0]<other2[1])printf("Winner is B!\n");
									if(other1[0]==other2[1])printf("Draw!\n");
								}
						}
				}
				else printf("Winner is A!\n");
			}
			else
			{
				if(sum_B[e]-sum_B[g]==2)printf("Winner is B!\n");
				else if(sum_B[e]%30==sum_B[f]%30&&sum_B[e]%30==sum_B[f]%30)printf("Winner is B!\n");
				else if(other2[m]-other2[q]==2&&other2[m]-other2[n]==1)printf("Winner is B!\n");
				else if(sum_B[e]%30==sum_B[f]%30||sum_B[e]%30==sum_B[g]%30||sum_B[f]%30==sum_B[g]%30)printf("Winner is B!\n");
				else
				{
					if(other1[z]>other2[m])printf("Winner is A!\n");
					if(other1[z]<other2[m])printf("Winner is B!\n");
					if(other1[z]==other2[m])
						{
							if(sum_A[z]>sum_B[m])printf("Winner is A!\n");
							if(sum_A[z]<sum_B[m])printf("Winner is B!\n");
							if(sum_A[z]==sum_B[m])
								{
									if(other1[x]>other2[n])printf("Winner is A!\n");
									if(other1[x]<other2[n])printf("Winner is B!\n");
									if(other1[x]==other2[n])
										{
											if(sum_A[x]>sum_B[n])printf("Winner is A!\n");
											if(sum_A[x]<sum_B[n])printf("Winner is B!\n");
											if(sum_A[x]==sum_B[n])
											{
												if(other1[y]>other2[q])printf("Winner is A!\n");
												if(other1[y]<other2[q])printf("Winner is B!\n");
												if(other1[y]==other2[q])
													{
														if(sum_A[y]>sum_B[q])printf("Winner is A!\n");
														if(sum_A[y]<sum_B[q])printf("Winner is B!\n");
														if(sum_A[y]==sum_B[q])printf("Draw!\n");
													}
											}
										}
								}
						}
				}
			}
			int t;
			if(other1[z]==other1[x]&&other1[x]==other1[y]){z=a;x=b;y=c;}
			else 
			{
				if(other1[z]==other1[x]&&start1[z]<start1[x]){t=z;z=x;x=t;}
				else if(other1[x]==other1[y]&&start1[x]<start1[y]){t=x;x=y;y=t;}
			}
			
			if(other2[n]==other2[q]&&other2[m]==other2[q]){m=e;n=f;q=g;}
			else 
			{
				if(other2[m]==other2[n]&&start2[m]<start2[n]){t=m;m=n;n=t;}
				if(other2[n]==other2[q]&&start2[n]<start2[q]){t=n;n=q;q=t;}
			}
			printf("A: %s %s %s\n",A[z],A[x],A[y]);
			printf("B: %s %s %s\n",B[m],B[n],B[q]);
		}
	if(worry==1)
		printf("Input Error!\n");

}